﻿@{
    Layout = "_UserSpaceSettings";
    ViewData["UserSettingsMenu"] = UserSettingsMenu.UserEducation;
    KeyValuePair<PrivacyStatus, string> privacySet = ViewData.Get<KeyValuePair<PrivacyStatus, string>>("EditUserEducationPrivacy", new KeyValuePair<PrivacyStatus, string>(PrivacyStatus.Part, "我收藏的人可见"));
}
@section Aside
{
    @Html.Partial("_UserSettingsMenus", ViewData)
}
<div class="tn-box tn-widget tn-widget-content tn-corner-all tnc-edit-edu">
    <div class="tn-box-content tn-widget-content tn-corner-all">
        <div class="tn-form tn-label-right tnc-education">
            <div class="tn-main-heading tn-border-gray tn-border-bottom">
                <div id="privacyset" style="position: absolute; display: none;" class="tn-privacy-set-box tn-widget-content tn-border-gray">
                    @using (Html.BeginAjaxForm("EditUserEducationPrivacySetting", "UserSpaceSettings", null, FormMethod.Post, new AjaxFormOptions { OnSuccessCallBack = "EditUserEducationPrivacySettingOnSuccessCallBack" }))
                    {
                        <div class="tn-form">
                            <div class="tn-form-row">
                                <ul class="tn-radiobutton-list">
                                    <li>
                                        @Html.RadioButton("EditUserEducationPrivacy", PrivacyStatus.Public.ToString(), privacySet.Key == PrivacyStatus.Public, new { id = "EditUserEducationPrivacy-" + PrivacyStatus.Public.ToString() })
                                        <label for="EditUserEducationPrivacy-@PrivacyStatus.Public.ToString()">
                                            所有人可见</label>
                                    </li>
                                    <li>
                                        @Html.RadioButton("EditUserEducationPrivacy", PrivacyStatus.Part.ToString(), privacySet.Key == PrivacyStatus.Part, new { id = "EditUserEducationPrivacy-" + PrivacyStatus.Part.ToString() })
                                        <label for="EditUserEducationPrivacy-@PrivacyStatus.Part.ToString()">
                                            我收藏的人可见</label>
                                    </li>
                                    <li>
                                        @Html.RadioButton("EditUserEducationPrivacy", PrivacyStatus.Private.ToString(), privacySet.Key == PrivacyStatus.Private, new { id = "EditUserEducationPrivacy-" + PrivacyStatus.Private.ToString() })
                                        <label for="EditUserEducationPrivacy-@PrivacyStatus.Private.ToString()">
                                            仅自己可见</label>
                                    </li>
                                </ul>
                            </div>
                            <div class="tn-form-row tn-form-row-button">
                                @Html.Button("确定", ButtonTypes.Submit, HighlightStyles.Primary, ButtonSizes.Default)
                            </div>
                        </div>
                    }
                </div>
                <div class="tn-option">
                    <span id="spanprivacyset">隐私设置：@privacySet.Value </span><a menu="#privacyset" data_menu_clicktrigger="true"
                        href="#" class="tn-action"><span class="tn-action-text">更改</span></a></div>
                <h2>
                    教育经历</h2>
            </div>
            <div id="UserEducations">
                @Html.Action("_UserEducations", new RouteValueDictionary { { "spaceKey", Url.SpaceKey() } })
            </div>
            <div id="UserEducationInfo">
                @Html.Action("_EditUserEducationInfo", new RouteValueDictionary { { "spaceKey", Url.SpaceKey() } })
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    function UserEducationInfoCallback(educationId) {
        $("#UserEducationInfo").load('@(Url.Action("_EditUserEducationInfo", "UserSpaceSettings", new { spaceKey = Url.SpaceKey() }))', { educationId: educationId }); 
        $("#CreateEducation").focus();
    }

    function EditUserEducationPrivacySettingOnSuccessCallBack(data) {
        $("#spanprivacyset").html("隐私设置：" + $("input[name='EditUserEducationPrivacy']:checked").next().html());
        $("#privacyset").hide();
        art.dialog.tips(data.MessageContent, 1.5, data.MessageType);
    }
</script>
